<?php
/**
 * 首页数据
 * @author 高天杰 2014-08-21
 */
class IndexModel extends Model
{
	//最近数据条数
	public static $limit = 10;
	
	/**
	 * 最新班级动态
	 */
	public static function getLatestMove()
	{
        $move = M("move")->order("m_id desc ")->limit(self::$limit)->select();
        
        if (!empty($move)) {
        	return $move;
        } 

        return array();
	}

	/**
	 * 最新留言
	 */
	public static function getLatestLeave()
	{
        $leave = M("leave")->order("le_id desc ")->limit(self::$limit)->select();
        
        if (!empty($leave)) {
        	return $leave;
        } 
      
        return array();
	}

    /**
	 * 最新班级文章
	 */
	public static function getLatestArticle()
	{
        $move = M("article")->order("ar_id desc ")->limit(self::$limit)->select();
        
        if (!empty($move)) {
        	return $move;
        } 

        return array();
	}

	/**
	 * 最新登录的用户
	 */
	public static function getLatestLoginUser()
	{
        $loginUser = M("user")->table("tp_user u,tp_user_login l")->field("l.u_id,l.login_start_time,u.u_image,u.u_name")
        ->where("u.u_id=l.u_id")->group("u.u_id")->limit(PAGE_NUMBER)->select(); 
        
        if (!empty($loginUser)) {
            return $loginUser;
        }

        return array();
	}

	/**
	 *
	 */
	public static function getNewPhoto()
	{
		$photo = M("photo");

        $photoNum = $photo->join("")->order("p_date desc")->limit(4)->select();		
	}

}
?>